Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-path

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-path

Serialize Canvas path commands to SVG.

  • 3.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is d3-path?

The d3-path npm package is a part of the D3.js library and provides a way to create and manipulate SVG path elements. It offers a simple API to generate complex path data for SVG elements, which can be used for drawing shapes, lines, and curves in web applications.

What are d3-path's main functionalities?

Move To

The moveTo method sets the starting point of a new sub-path to the specified (x, y) coordinates.

const d3 = require('d3-path');
const path = d3.path();
path.moveTo(100, 100);
console.log(path.toString());

Line To

The lineTo method adds a straight line from the current point to the specified (x, y) coordinates.

const d3 = require('d3-path');
const path = d3.path();
path.moveTo(100, 100);
path.lineTo(200, 200);
console.log(path.toString());

Arc

The arc method creates an arc centered at (x, y) with the specified radius and start and end angles.

const d3 = require('d3-path');
const path = d3.path();
path.arc(150, 150, 50, 0, Math.PI / 2);
console.log(path.toString());

Bezier Curve

The bezierCurveTo method creates a cubic Bézier curve from the current point to the specified (x, y) coordinates using the specified control points.

const d3 = require('d3-path');
const path = d3.path();
path.moveTo(100, 100);
path.bezierCurveTo(150, 50, 200, 150, 250, 100);
console.log(path.toString());

Close Path

The closePath method closes the current sub-path by drawing a straight line back to the starting point.

const d3 = require('d3-path');
const path = d3.path();
path.moveTo(100, 100);
path.lineTo(200, 200);
path.closePath();
console.log(path.toString());

Other packages similar to d3-path

Keywords

FAQs

Package last updated on 19 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc